<template>
  <bm-marker
    :position="device.location"
    :dragging="false"
    @mouseover="show=true"
    @mouseout="show=false"
  >
    <bm-info-window
      :show="show"
    >
      <div>设备号: {{ device.id }}</div>
      <div>设备名: {{ device.name }}</div>
      <div>注册时间: {{ device.regTime }}</div>
      <div>坐标: {{ device.location.lat }}, {{ device.location.lng }}</div>
    </bm-info-window>
  </bm-marker>
</template>

<script>
import BmMarker from 'vue-baidu-map/components/overlays/Marker'
import BmInfoWindow from 'vue-baidu-map/components/overlays/InfoWindow'

export default {
  name: 'InfoMarker',

  components: {
    BmMarker,
    BmInfoWindow
  },

  data() {
    return {
      show: false
    }
  },

  props: {
    device: {
      type: Object,
      required: true
    }
  },

  methods: {
  }
}
</script>

<style>

</style>
